Algorithms in C, Part 5: Graph Algorithms: Graph Algorithms Pt.5 by Robert Sedgewick

Algorithms in C, Part 5: Graph Algorithms: Graph Algorithms Pt.5 by Robert Sedgewick

Author:Robert Sedgewick [Sedgewick, Robert]
Language: eng
Format: mobi
Publisher: Pearson Education
Published: 2001-08-16T04:00:00+00:00


Program 20.4 Priority-first search (adjacency lists)

This program is a generalized graph search that uses a priority queue to manage the fringe (see section 18.8). The priority P is defined such that the ADT function GRAPHpfs implements Prim's MST algorithm for sparse (connected) graphs. Other priority definitions implement different graph-processing algorithms.

The program moves the highest priority (lowest weight) edge from the fringe to the tree, then checks every edge adjacent to the new tree vertex to see whether it implies changes in the fringe. Edges to vertices not on the fringe or the tree are added to the fringe; shorter edges to fringe vertices replace corresponding fringe edges.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.